package com.zimmor.rocketmq.selector;

import org.apache.rocketmq.client.producer.MessageQueueSelector;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageQueue;

import java.util.List;

/**
 * @Author:zimmor
 * @Date: 2023/2/17 15:30
 * @Description
 * @version: 1.0.0
 */

public class OrderSelector implements MessageQueueSelector {
    @Override
    public MessageQueue select(List<MessageQueue> list, Message message, Object o) {
        Integer index = Integer.valueOf((String) o);
        return list.get(index % list.size());
    }
}
